﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DelegetAndEventTest
{
    /// <summary>
    /// 刘备的举杯的委托
    /// </summary>
    /// <param name="hand"></param>
    public delegate void RaiseHandler(string hand);
    /// <summary>
    /// 刘备摔杯子的委托
    /// </summary>
    public delegate void FallHandler();
    /// <summary>
    /// 刘备砸桌子的委托
    /// </summary>
    /// <param name="i"></param>
    /// <returns></returns>
    public delegate string ZaHandler(int i);

    /// <summary>
    /// 这个是刘备用来发号施令
    /// </summary>
    public class A
    {
        public event ZaHandler ZaEvent;
        public event RaiseHandler RaiseEvent;
        public event FallHandler FallEvent;
        public RaiseHandler raise;
        public Action action;
        //举杯（左手举杯还是右手举杯）
        public void Raise(string hand)
        {
            RaiseEvent?.Invoke(hand);
        }
        /// <summary>
        /// 摔杯子
        /// </summary>
        public void Fall()
        {
            FallEvent?.Invoke();
        }

        public string Za(int i)
        {
            return ZaEvent?.Invoke(i);
        }
    }
}
